﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dror.Common.Data.Contracts;

namespace Entities
{
    public class PlaceInfo : IEntity
    {
        public virtual long Id { get; set; }
        public virtual string Reference { get; set; }
        public virtual string Name { get; set; }
        public virtual string Address { get; set; }
        public virtual string Phone { get; set; }
        public virtual string WebsiteUrl { get; set; }
        public virtual string AboutUsPageUrl { get; set; }
        public virtual string ContactUsPageUrl { get; set; }
        public virtual string FacebookPageUrl { get; set; }
        public virtual string Pinterest { get; set; }
        public virtual long Likes { get; set; }
        public virtual bool DoesIncludePinItButton { get; set; }
        public virtual IList<string> Emails { get; set; }
        public virtual IList<PinterestUserInfo> PinterestUserInfo { get; set; }

        public PlaceInfo()
        {
            PinterestUserInfo = new List<PinterestUserInfo>();
            Emails = new List<string>();
        }

        public virtual string GetFacebookUniqueIdentifier()
        {
            return FacebookPageUrl == null ? string.Empty : FacebookPageUrl.Split('/').LastOrDefault();
        }

        public virtual void AddUserInfo(PinterestUserInfo userInfo)
        {
            userInfo.PlaceInfo = this;
            PinterestUserInfo.Add(userInfo);
        }

        public virtual void RemoveUserInfo(PinterestUserInfo userInfo)
        {
            userInfo.PlaceInfo = null;
            PinterestUserInfo.Remove(userInfo);
        }
    }
}
